package br.com.exatta.negocio;

import org.hibernate.Query;

import br.com.exatta.dados.Terminal;

public class ConsultaTerminal extends ConsultaGenerica<Terminal> {

	private static final long serialVersionUID = -6252383862349413654L;

	private Integer codigo;

	public ConsultaTerminal() {
	}

	public Integer getCodigo() {
		return codigo;
	}

	@Override
	public String getHql() {
		StringBuilder sb = new StringBuilder();
		sb.append("FROM Terminal t");
		boolean where = false;
		if (codigo != null) {
			where = append(sb, where, "t.codigo = :codigo");
		}
		return sb.toString();
	}

	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}

	@Override
	public void setParameters(Query q) {
		if (codigo != null) {
			q.setInteger("codigo", codigo);
		}
	}
}
